package _01simple;

import org.junit.Test;

/**
 * @author ServivE
 * @version 0.1
 * @className SimpleFactory
 * @description
 * @date 2024/10/15 9:37
 * @since jdk17
 */
public class SimpleFactory {
//    工厂方法获取对应的汽车
    public static Car getMeCar(String name){
        if ("audi".equals(name)) {
            return new Audi();
        } else if ("bmw".equals(name)) {
            return new BMW();
        } else if ("benz".equals(name)) {
            return new Benz();
        }
        return null;
    }

}
